<template>
  <div class="app-container">
    <!-- 功能区 -->
    <transition name="formFade">
      <el-card class="operate-container" shadow="never" v-if="showSearch">
        <el-form :inline="true" :model="listQuery" @submit.native.prevent>
          <el-form-item label="是否暂停项目" class="form-item">
            <el-select placeholder="请选择" style="width:100%;" clearable v-model="listQuery.needStop"
                       class="form-select" :popper-append-to-body="false" popper-class="select-popper">
              <el-option :value="0" label="不暂停"></el-option>
              <el-option :value="1" label="暂停"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="整改状态" class="form-item">
            <el-select placeholder="请选择" style="width:100%;" clearable v-model="listQuery.status"
                       class="form-select" :popper-append-to-body="false" popper-class="select-popper">
              <el-option :value="0" label="下达整改单"></el-option>
              <el-option :value="1" label="整改后提交"></el-option>
              <el-option :value="2" label="整改通过"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="form-item">
            <el-button type="primary" size="mini" icon="el-icon-search" @click="getList">查询</el-button>
          </el-form-item>
        </el-form>
      </el-card>
    </transition>
    <div class="table_content">
      <headerSearch :showAdd="false"
                    @creRefresh="getList"
                    @isSearch="showSearch = !showSearch"></headerSearch>
      <!--表格渲染-->
      <el-table ref="table" v-loading="loading" :data="list" style="width: 100%;" border
                :header-cell-style="{background: '#F8F8F9',padding: '6px 0 !important',color: '#515a6e'}">
        <!--<af-table-column prop="projectType" fixed="left" label="工程类型" >
          <template slot-scope="scope">
            {{{'0':'工程项目','1':'政府采购项目','2':'资产资源招标'}[scope.row.projectType]}}
          </template>
        </af-table-column>-->
        <af-table-column prop="needStop" label="是否暂停项目" >
          <template slot-scope="scope">
            {{{'0':'不暂停','1':'暂停'}[scope.row.needStop]}}
          </template>
        </af-table-column>
        <af-table-column prop="reason" label="整改原因" />
        <af-table-column prop="desc" label="整改描述" />
        <af-table-column prop="superviseUserName" label="监督用户名" />
        <af-table-column prop="status" label="整改状态" >
          <template slot-scope="scope">
            {{{'0':'下达整改单','1':'整改后提交','2':'整改通过'}[scope.row.status]}}
          </template>
        </af-table-column>
        <af-table-column prop="rectifyTime" label="整改单下达时间" />
        <af-table-column align="center" fixed="right" label="操作">
          <template slot-scope="scope">
            <el-button class="btn" type="text" size="small"
                       @click="handleEdit(scope.$index,scope.row)">恢复</el-button>
            <el-button class="btn" type="text" size="small"
                       @click="handleEdit(scope.$index,scope.row)">回退</el-button>
          </template>
        </af-table-column>
      </el-table>

      <!--分页-->
      <pagination v-show="total>0" :total="total"
                  :page.sync="listQuery.pageNum"
                  :limit.sync="listQuery.pageSize"
                  @pagination="getList" />
    </div>
  </div>
</template>

<script>
  import { doPost, doGet, doFile, orglistChild } from '@/api/index'
  import Pagination from '@/components/Pagination/index'
  import headerSearch from '@/components/headerSearch/headerSearch'

  export default {
    name: "abarbeitung",
    components: {Pagination, headerSearch},
    data() {
      return {
        loading: false,
        list: [],
        total: 0,
        listQuery: {
          pageNum: 1,
          pageSize: 20,
          projectType: 1,
          needStop: '',
          status: ''
        },
        showSearch: true
      }
    },
    created() {
      this.getList()
    },
    methods: {
      getList() {
        this.loading = true
        doPost('rectify/page',this.listQuery).then(res => {
          this.loading = false
          this.list = res.data.list
          this.total = res.data.total
        }).catch(error => {
          this.list = []
          this.total = 0
          this.loading = false
        })
      },
      handleEdit(index, row) {}
    }
  }
</script>

<style scoped>

</style>
